/*
* Copyright (C) Microsoft. All rights reserved.  
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not 
* use this file except in compliance with the License.  You may obtain a copy 
* of the License at http://www.apache.org/licenses/LICENSE-2.0  
* 
* THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED 
* WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, 
* MERCHANTABLITY OR NON-INFRINGEMENT. 
*
* See the Apache License, Version 2.0 for specific language governing 
* permissions and limitations under the License.
*
*/
#include "pch.h"
#include <baja/db/db_table.h>
#include <assert.h>

using namespace baja::storage;

table::table(std::wstring name) :
    _name(name),
    _id(0)
{
    _columns = std::make_shared<std::vector<std::shared_ptr<icolumn>>>();
    _indices = std::make_shared<std::vector<std::shared_ptr<iindex>>>();
}
 
std::shared_ptr<itable> table::create(std::wstring name)
{
    return std::make_shared<table>(name);
}

void table::setId(table_id id)
{
    _id = id;
}

table_id table::getId()
{
    return _id;
}

std::wstring table::getName()
{
    return _name;
}

void table::addColumn(std::shared_ptr<icolumn> column)
{
    _columns->push_back(column);
}

std::shared_ptr<std::vector<std::shared_ptr<icolumn>>> table::getColumns()
{
    return _columns;
}

void table::addIndex(std::shared_ptr<iindex> index)
{
    _indices->push_back(index);
}

std::shared_ptr<std::vector<std::shared_ptr<iindex>>> table::getIndices()
{
    return _indices;
}

std::shared_ptr<itable> baja::storage::createTable(std::wstring name)
{
    return table::create(name);
}

